/*
 * �b 2004/5/18 �إ�
 */
package jaoso.framework.web.action;

import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

import javax.servlet.http.HttpServletRequest;

/**
 * @author edgeloner edgeloner@163.com
 * 
 *  
 */
public class BaseAction extends DispatchAction
{
    /**
     * remove attribute from request or session
     * 
     * @param mapping
     *            actionMapping
     * @param request
     *            request
     */
    protected final void removeAttribute(final ActionMapping mapping,
            final HttpServletRequest request)
    {
        if (mapping.getAttribute() != null)
        {
            if ("request".equals(mapping.getScope()))
            {
                request.removeAttribute(mapping.getAttribute());
            } else
            {
                request.getSession().removeAttribute(mapping.getAttribute());
            }
        }
    }
}